<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>bai 2.5 Tính cạnh huyền tam giác vuông</title>
</head>
<?php
	if(isset($_POST["canha"]))
	{
		$canha = $_POST["canha"];
		if(isset($_POST["canhb"]))
		{
			$canhb = $_POST["canhb"];
			$canhhuyen = sqrt(pow($canha,2) + pow($canhb,2));
		}
	}
?>

<body>
	<form action="" method="post">
		<table width="30%" border="0" cellspacing="0" cellpadding="6" bgcolor="#FEEBCB" style="margin:auto">
		  <tr>
			<td colspan="2" align="center" style="color:#A24800; background:#FFCA71"><font size="+1" style="font-weight:bold">CẠNH HUYỀN TAM GIÁC VUÔNG</font></td>
		  </tr>
		  <tr>
			<td width="27%">Cạnh A :</td>
			<td width="73%" align="center">
				<input type="text" name="canha" maxlength="100%" style="width:60%" value=" <?php if(isset($canha)) echo $canha; ?>" />
			</td>
		  </tr>
		  <tr>
			<td>Cạnh B :</td>
			<td align="center">
				<input type="text" name="canhb" maxlength="100%" style="width:60%" value=" <?php if(isset($canhb)) echo $canhb; ?>"/>
			</td>
		  </tr>
		  <tr>
			<td>Cạnh huyền :</td>
			<td align="center">
				<input type="text" name="canhhuyen" readonly="true" maxlength="100%" style="width:60%; background-color:#FFCACF" value=" <?php if(isset($canhhuyen)) echo $canhhuyen; ?>"/>
			</td>
		  </tr>
		  <tr>
			<td colspan="2" align="center">
				<input type="submit" name="tinh" value="Tính" align="middle" />
			</td>
		  </tr>
		</table>
	</form>
</body>
</html>
